<?php
$message =
"Thank you for registering for the " . $registration['Tournament']['name'] .
" tournament which takes place on " . $registration['Tournament']['date'] .
" in " . $registration['Tournament']['location'] . ".\n\n" .

"If you ever need to change your registration, go back to the registration page at fmquizzing.net/registration and click on the link at the top of the page marked \"Edit Previous Registration\" and enter your email and resumption key: \n\n" .

"email: " . $registration['Registration']['email'] . "\n" .
"resumption key: " . $registration['Registration']['resumption_key'] . "\n\n" .

"Here is a copy of the rest of your registration for your records:\n" .
"Church name: " . $registration['Registration']['church_name'] . "\n" .
"Conference: " . $registration['Registration']['conference'] . "\n" .
"Coach name: " . $registration['Registration']['coach_name'] . "\n" .
"Email address: " . $registration['Registration']['email'] . "\n" .
"Daytime phone: " . $registration['Registration']['daytime_phone'] . "\n" .
"Evening phone: " . $registration['Registration']['evening_phone'] . "\n" .
"Number for lunch: " . $registration['Registration']['number_for_lunch'] . "\n" .
"Number of seats: " . $registration['Registration']['number_of_seats'] . "\n\n";

$message .= "Teams:\n";
foreach($registration['Team'] as $team):
    $message .= $team['division'] . "\n";
endforeach;
$message .= "\n";

$message .= "Individuals:\n";
foreach($registration['Individual'] as $individual):
    $message .= $individual['name'] . ": " . $individual['division'] . "\n";
endforeach;
$message .= "\n";

$message .= "Quizmasters:\n";
$m = "";
foreach($registration['Quizmaster'] as $quizmaster):
    $m .= $quizmaster['name'] . ": ";
    if($quizmaster['can_do_STVA'] == 1) {$m .= "STVA, ";}
    if($quizmaster['can_do_STVB'] == 1) {$m .= "STVB, ";}
    if($quizmaster['can_do_STR'] == 1) {$m .= "STR, ";}
    if($quizmaster['can_do_YTVA'] == 1) {$m .= "YTVA, ";}
    if($quizmaster['can_do_YTVB'] == 1) {$m .= "YTVB, ";}
    if($quizmaster['can_do_YTRA'] == 1) {$m .= "YTRA, ";}
    if($quizmaster['can_do_YTRB'] == 1) {$m .= "YTRB, ";}
    if($quizmaster['can_do_RO'] == 1) {$m .= "RO, ";}
    $m .= "\n";
endforeach;
$message .= $m . "\n";


$message .= "Housing:\n";
foreach($registration['Housee'] as $housee):
    $message .= $housee['name'] . ": " . $housee['type'] . "\n";
endforeach;
$message .= "\n";

echo $message;
